using System.Collections.Generic;
using System.Collections.Specialized;

namespace OracleInternal.SqlAndPlsqlParser
{
	internal class DoubleStageCharPropertiesTable
	{
		private const int c_vFirstTableSize = 256;

		private const int m_vSecondTableSize = 8;

		private int[] m_vFirstTable = new int[256];

		private BitVector32[][] m_vSecondTables;

		public DoubleStageCharPropertiesTable(string chars)
		{
			for (int i = 0; i < 256; i++)
			{
				m_vFirstTable[i] = -1;
			}
			List<BitVector32[]> list = new List<BitVector32[]>();
			for (int j = 0; j < chars.Length; j++)
			{
				int num = chars[j];
				int num2 = num / 256;
				BitVector32[] array;
				if (m_vFirstTable[num2] == -1)
				{
					array = new BitVector32[8];
					for (int k = 0; k < 8; k++)
					{
						array[k] = new BitVector32(0);
					}
					m_vFirstTable[num2] = list.Count;
					list.Add(array);
				}
				else
				{
					array = list[num2];
				}
				num %= 256;
				array[num / 32][1 << num % 32] = true;
			}
			m_vSecondTables = list.ToArray();
		}

		public bool Contains(char c)
		{
			int num = (int)c / 256;
			num = m_vFirstTable[num];
			if (num == -1)
			{
				return false;
			}
			int num2 = (int)c % 256;
			return m_vSecondTables[num][num2 / 32][1 << num2 % 32];
		}
	}
}
